home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / INTERVIE / SPACE.H < prev    next >
C/C++ Source or Header  |  1980-01-03  |  3KB  |  109 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * Object space definition.
  25.  */
  26.  
  27. #ifndef objectspace_h
  28. #define objectspace_h
  29.  
  30. #include <InterViews/stub.h>
  31.  
  32. class Catalog;
  33. class Messenger;
  34. class ObjectTable;
  35. class SpaceManager;
  36.  
  37. class ObjectSpace : public ObjectStub {
  38. public:
  39.     ObjectSpace(const char*);
  40.     ~ObjectSpace();
  41.  
  42.     void StartServer(Connection* local, Connection* remote);
  43.  
  44.     void UsePath(const char*);
  45.     Connection* Find(const char*, boolean wait = false);
  46.  
  47.     void Dispatch();
  48.  
  49.     void Message(Connection*, ObjectTag, int op, void*, int len);
  50.     void Deliver(Connection*, ObjectTag, int op, void*, int);
  51.     ObjectStub* Map(Connection*, ObjectTag);
  52.  
  53.     void AddChannel(int, ObjectStub*);
  54.     void RemoveChannel(int);
  55.  
  56.     void Attach(int);
  57.     void Detach(int);
  58. protected:
  59.     const char* name;
  60.     Catalog* dictionary;
  61.     ObjectTable* table;
  62.  
  63.     ObjectSpace();
  64. private:
  65.     struct MQueue {
  66.     Messenger* head, * tail;
  67.     };
  68.     struct Stream {
  69.     int channel, mask;
  70.     ObjectStub* object;
  71.     Stream* next;
  72.     };
  73.  
  74.     Connection* local;
  75.     Connection* remote;
  76.     SpaceManager* manager;
  77.     int channels;
  78.     int maxchannel;
  79.     MQueue active;
  80.     MQueue inactive;
  81.     Stream* streams;
  82.  
  83.     void Init();
  84.     void Listen(Connection*);
  85.     boolean Ready(int, Connection*);
  86.     void CheckServer(int, Connection*);
  87.     void CheckClients();
  88.     void Add(Messenger*, MQueue&);
  89.     void Remove(Messenger*, MQueue&);
  90.     void CloseDown(Messenger*);
  91.     virtual void AddClient(Connection*);
  92. };
  93.  
  94. /*
  95.  * Protocol definitions.
  96.  */
  97.  
  98. static const int objectspace_Find = 1;
  99. static const int objectspace_Clone = 2;
  100. static const int objectspace_Destroy = 3;
  101.  
  102. struct objectspace_Msg {
  103.     ObjectTag tag;
  104.     char name[1];
  105.     /* rest of name */
  106. };
  107.  
  108. #endif
  109.